﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrgTree_Bottom.aspx.cs" Inherits="SysManage_OrgTree_Bottom" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
 <title>组织树</title>
    <link rel="stylesheet" href="../css/css.css" type="text/css" />
    <script language="javascript" type="text/javascript">
     var stype;
     function btnMageClk(type)
     {//debugger;
        stype = type;
        var sobj = parent.RightFrame.hidform.hOrgInfo.value ;
        var sOrgType = parent.RightFrame.hidform.hOrgType.value ;
        var sPCIDCOl = parent.RightFrame.hidform.hParentChildIDCol.value ;  //当前结点的直系上下级包括自己的ID集合
        OrgForm.Hcode.value = sobj;
        var sFeatures = "dialogHeight:400px;dialogWidth:600px;resizeable:no;help:no;status:no";
        //type:1-增加；2-修改；3-删除；4-查看；5-显示删除；6-隐藏删除；7-导出；8-恢复已经删除的数据
        switch (type)
        { 
             case 1://增加
             
                if(sOrgType=="" || sOrgType==0)
                {
                alert("请选择左边的组织类别后,再点击此按钮!");
                return;
                }
                    if(""==sobj)
                    {
                        alert("没有选择组织名称时,默认创建顶级组织");
                    }
                    showModalDialog("OrgTree_Other_Edit.aspx?OrgType="+sOrgType,window,sFeatures);
                    //刷新GridView
				    var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh1");
				    if(btnRefresh!=null)
				       btnRefresh.click();
                    break;
             case 2://修改
                    if(""==sobj)
                    {
                        alert("请选择要修改的组织名称");
                        return;
                    }      
                    showModalDialog("OrgTree_Other_Edit.aspx?OrgType="+sOrgType+"&ParentChildID="+sPCIDCOl,window,sFeatures);
                    //刷新GridView
				    var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh2");
				    if(btnRefresh!=null)
				        btnRefresh.click();				    
                    break;
            case 3: //删除
                    if(""==sobj)
                    {
                        alert("请选择要删除的组织名称");
                        return;
                    }             
                    if(confirm("真的要删除该条记录？"))
                    {
				        var ifrmDel=parent.RightFrame.document.getElementById("BtnDel");
				        if(ifrmDel!=null)
				        {
				          ifrmDel.click();				         
				        }
                    }
                    else
                    {
                        var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh2");
				        if(btnRefresh!=null)
				            btnRefresh.click();	
                    }
                    break;
            case 4://查看 
                    if(""==sobj)
                    {
                        alert("请选择一条记录再查看");
                        return;
                    }             
                    showModalDialog("OrgTree_Other_View.aspx",window,sFeatures);
//                    var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh2");
//				    if(btnRefresh!=null)
//				        btnRefresh.click();
                    break;          
            case 5: //显示删除      
                    //按钮处理      
				    window.document.all.btn_hide_del.style.display= "inline";
				    window.document.all.btn_disp_del.style.display= "none";
				    window.document.all.btn_resume.style.display= "inline";
				    //window.document.all.btn_export.style.display= "none";
				    //操作按钮处理				    				    
				    window.document.all.btn_new_pd.disabled=true;
				    window.document.all.btn_hf_view.disabled=true;
				    window.document.all.btn_hf_del.disabled=true;
				    //window.document.all.btn_export.disabled=true;
				    //显示删除
				    var vDel=parent.RightFrame.document.getElementById("BtnDispDel");
				    if(vDel!=null)vDel.click();
                    break;
            case 6: //隐藏删除
                    //本身删除变化按钮处理  
                    window.document.all.btn_disp_del.style.display= "inline";
				    window.document.all.btn_hide_del.style.display= "none";
				    //window.document.all.btn_export.style.display= "inline";
				    window.document.all.btn_resume.style.display= "none";
				    //操作按钮处理				    				    
				    window.document.all.btn_new_pd.disabled=false;
				    window.document.all.btn_hf_view.disabled=false;
				    window.document.all.btn_hf_del.disabled=false;
				    //window.document.all.btn_export.disabled=false;
				    //显示删除
				    var vDel=parent.RightFrame.document.getElementById("BtnHideDel");
				    if(vDel!=null)vDel.click();
                    break;
            case 7: //导出
				    var ifrm=parent.RightFrame.document.getElementById("BtnExport");
				    if(ifrm!=null)ifrm.click();
                    break;
            case 8: //恢复已经删除的数据

                    if(""==sobj)
                    {
                        alert("请选择一条记录进行恢复");
                        return;
                    } 
                    var d8 = sobj.split(',');
                    if("1"==d8[10])
                    {
                        alert("该行数据已经存在，不需要恢复");
                        return;
                    }
				    var ifrm=parent.RightFrame.document.getElementById("BtnResume");
				    if(ifrm!=null)ifrm.click();
                    break;  
            case 9://打印组织树
                    showModalDialog("OrgTree_Print.aspx?OrgType="+sOrgType,window,sFeatures);
                    var btnRefresh=parent.RightFrame.document.getElementById("BtnRefresh2");
				    if(btnRefresh!=null)
				        btnRefresh.click();
                    break;
            case 10://发布
                    var btnRefresh=parent.RightFrame.document.getElementById("BtnPublish");
				    if(btnRefresh!=null)
				        btnRefresh.click();
                    break;
         }
     }
    </script>
</head>
<body style =" background-image :url('../images/hit_bg.gif');">
    <form id="OrgForm" runat="server">
    <table align="center" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td style ="width:30%;"></td>
          <td align ="center" >
              <input name="btn_new_pd"  id="btn_new_pd" type="button" class="button03" onclick="btnMageClk(1)" value="增加(A)" accesskey ="a"/>
              <input name="btn_hf_view"  id="btn_hf_view" type="button" class="button03"  onclick= "btnMageClk(2)" value="修改(E)" accesskey ="e" />
              <input name="btn_hf_del" id="btn_hf_del" type="button" class="button03"  onclick= "btnMageClk(3)"    value="删除(D)" accesskey ="d"  />
              <input name="btn_view" id="btn_view" type="button" class="button03"  onclick= "btnMageClk(4)"   value="查看(V)" accesskey ="v"  />
              <input name="btn_disp_del" id="btn_disp_del" type="button" class="button05"  onclick= "btnMageClk(5)"    value="显示删除(G)" accesskey ="g"  style="display:inline;" />
              <input name="btn_hide_del" id="btn_hide_del" type="button" class="button05"  onclick= "btnMageClk(6)"   value="隐藏删除(H)" accesskey ="h" style="display:none;" />
              <input name="btn_resume" id="btn_resume" type="button" class="button03"  onclick= "btnMageClk(8)"     value="恢复(r)" accesskey ="r" style="display:none;" />
              <input name="btn_Print"  id="btn_Print" type="button" class="button03" onclick="btnMageClk(9)"  value="打印(P)" accesskey ="p"/>
              <input name="btn_Publish"  id="btn_Publish" type="button" class="button03" onclick="btnMageClk(10)"  value="发布(S)" accesskey ="s"/>
          </td> 
        </tr>
      </table>
        <input id="Hcode" type="hidden" />
        <input type="hidden" id="hID" runat ="server"  />
        <input type="hidden" id="hName" runat ="server"  />
        <input type="hidden" id="hParentID" runat ="server" />
        <input type="hidden" id="hChildNumber" runat ="server" />
        <input type="hidden" id="hDOrder" runat ="server" />
        <input type="hidden" id="hEffective" runat ="server" />
        <input type="hidden" id="hParentName" runat ="server" />
    </form>
    <script language="javascript" type="text/javascript"  >
    <!--
    var stype;
    var nary;
    
    function Ininfor()
    {
      var sobj = Orglist.hidform.hOrgInfo.value ;      
      var ary=sobj.split(',');
      nary = ary.length;
      OrgForm.hID.value = ary[0];
      OrgForm.hName.value = ary[1];
      OrgForm.hParentID.value = ary[2];
      OrgForm.hChildNumber.value = ary[3];
      OrgForm.hDOrder.value = ary[4];
      OrgForm.hEffective.value = ary[5];
      OrgForm.hParentName.value = ary[6];
    }    
    
    function EditClick(type)
    {
        stype = type;
        Ininfor();
        if(nary<2 && stype=="2")
        {
          alert("请选择要修改的组织名称");
          return;
        }
        if(nary<2 && stype=="1")
        {
          alert("没有选择组织树时,系统将创建顶级组织");
        }
        var sFeatures = "dialogHeight:300px;dialogWidth:400px;resizeable:no;help:no;status:no";
        var obj=showModalDialog("OrgTree_Edit.aspx",window,sFeatures);
    }
    
    function DelInfo()
    { 
      if(confirm("真的要删除该条记录？"))
      {
		Ininfor();
      }
    }
    -->
</script>
</body>
</html>
